package com.xx.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xx.dao.DeleteSysLogMapper;
import com.xx.dao.FindSysLogMapper;
import com.xx.dao.InsertSysLogMapper;
import com.xx.domain.SysLog;
import com.xx.service.SysLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Author : 徐闯 ssm_admin
 * @Date : 2021-05-20 11:05:35
 * @Description : 系统日志业务
 **/
@Service
public class SysLogServiceImpl implements SysLogService {
    @Autowired
    private InsertSysLogMapper insertSysLogMapper;
    @Autowired
    private FindSysLogMapper findSysLogMapper;
    @Autowired
    private DeleteSysLogMapper deleteSysLogMapper;
    @Override
    @Transactional
    public int insertOne(SysLog sysLog) {
        return insertSysLogMapper.insertOne(sysLog);
    }

    @Override
    public PageInfo findALl(int num, int size) {
        PageHelper.startPage(num,size);
        List<SysLog> list = findSysLogMapper.findAll();
        PageInfo pageInfo = new PageInfo(list);
        return pageInfo;
    }

    @Override
    @Transactional
    public int deleteOne(String logId) {
        return deleteSysLogMapper.deleteOne(logId);
    }

    @Override
    @Transactional
    public int deleteList(String[] logIds) {
        return deleteSysLogMapper.deleteList(logIds);
    }
}
